
using System;
using System.Collections.Generic;
using System.Text;
using NFinal.Extension;

namespace WebApplication1.DDD.Models.Entity.Common
{
    public struct sms_send:NFinal.IModel
    {
		public System.Int64 id;
		public System.String phone;
		public System.String content;
		public System.Int64? time;
		public System.Int64? success;
		public System.String code;
		#region Nullable
		private bool __is_null__;
        public bool __Is_Null__
        {
            get {
                return __is_null__;
            }
            set
            {
                 __is_null__=value;
            }
        }
        public static implicit operator sms_send(string __value__)
        {
            var __value2__ = new sms_send();
            __value2__.__Is_Null__ = __value__==null;
            return __value2__;
        }
        public static  bool operator true(sms_send __value__)
        {
            return !__value__.__is_null__;
        }
        public static bool operator false(sms_send __value__)
        {
            return !__value__.__is_null__;
        }
		#endregion
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out sms_send par)
		{
			par=new sms_send();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.phone=get["phone"];
						par.content=get["content"];
						par.time=null;
						if(get["time"]!=null)
						{
							par.time=get["time"].AsVar();
						}
						par.success=null;
						if(get["success"]!=null)
						{
							par.success=get["success"].AsVar();
						}
						par.code=get["code"];
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"phone\":");
					tw.Write("\"");
					tw.Write(phone==null?"null":phone);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"content\":");
					tw.Write("\"");
					tw.Write(content==null?"null":content);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"time\":");
					tw.Write(time==null?"null" : time.ToString());
					tw.Write(",");
					tw.Write("\"success\":");
					tw.Write(success==null?"null" : success.ToString());
					tw.Write(",");
					tw.Write("\"code\":");
					tw.Write("\"");
					tw.Write(code==null?"null":code);
					tw.Write("\"");

			tw.Write("}");
		}
		#endregion
    }
}
